<?php

namespace App\Events\OpenShop;

use Illuminate\Broadcasting\Channel;
use Illuminate\Broadcasting\InteractsWithSockets;
use Illuminate\Broadcasting\PrivateChannel;
use Illuminate\Foundation\Events\Dispatchable;
use Illuminate\Queue\SerializesModels;

class OpenShopProcessEvent
{
    use Dispatchable, InteractsWithSockets, SerializesModels;

    /**
     * rms uid
     *
     * @var int
     */
    public int $uid;

    /**
     * 主流程id
     *
     * @var int
     */
    public int $mainProcessId;

    /**
     * 主流程阶段类型
     *
     * @var int
     */
    public int $mainProcessType;

    /**
     * 子流程类型
     *
     * @var int
     */
    public int $processType;


    /**
     * @param $uid
     * @param $mainProcessId
     * @param $mainProcessType
     * @param $processType
     */
    public function __construct($uid, $mainProcessId, $mainProcessType, $processType)
    {
        $this->uid = $uid;
        $this->mainProcessId = $mainProcessId;
        $this->mainProcessType = $mainProcessType;
        $this->processType = $processType;
    }

    /**
     * Get the channels the event should broadcast on.
     *
     * @return Channel
     */
    public function broadcastOn()
    {
        return new PrivateChannel('channel-name');
    }
}
